#include "task.h"
//#include "i2c_to_soc.h"
#include "uart_to_soc.h"



uint16_t g_count_100ms = 0;
uint16_t g_count_1s = 0;
uint16_t g_count_2s = 0;

uint8_t g_flag_100ms = 0;
uint8_t g_flag_1s = 0;
uint8_t g_flag_2s = 0;

//
void update_timer_task(void)
{
    if (TaskClock >= 10) //10ms
    {
        TaskClock = 0;
        g_count_100ms++;
        g_count_1s++;
        g_count_2s++;
    }
    
    if (g_count_100ms >= 10) //100
    {
        g_flag_100ms = 1;
        g_count_100ms = 0;
    }
    
    if (g_count_1s >= 100) //1s
    {
        g_flag_1s = 1;
        g_count_1s = 0;
    }
    
    if (g_count_2s >= 200) //2s
    {
        g_flag_2s = 1;
        g_count_2s = 0;
    }
}



void mcu_task_per_1s(void)
{
     if(g_flag_2s == 1) //1s
     {
         g_flag_2s = 0;
         //mcu_i2c_send_info();
     }
}


void mcu_task_per_100ms(void)
{ 
    if (g_flag_100ms == 1) //100ms
    {
        g_flag_100ms = 0;
        soc_uart_cmd_handler();
    }
}



